package cn.bdqn.activity01;

import android.annotation.SuppressLint;
import android.content.Intent;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.Button;

public class twoActivity extends AppCompatActivity {
    private static final String TAG="two——————————————+++++";
    private Button btn_two;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_two);
        Log.i(TAG,"实例化");

        //接受数据
        Intent intent=getIntent();
        int num=intent.getIntExtra("num",0);//基本类型要有默认值
        String msg=intent.getStringExtra("msg");


        btn_two=findViewById(R.id.btn_two);
        //内部类的形式
        btn_two.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent intent=new Intent(twoActivity.this,OneActivity.class);

                startActivity(intent);
            }
        });
    }

    @Override
    protected void onStart() {
        super.onStart();
        Log.i(TAG,"启动");
    }

    @Override
    protected void onResume() {
        super.onResume();
        Log.i(TAG,"交互");
    }

    @Override
    protected void onPause() {
        super.onPause();
        Log.i(TAG,"挂起");
    }

    @Override
    protected void onStop() {
        super.onStop();
        Log.i(TAG,"停止");
    }

    @Override
    protected void onRestart() {
        super.onRestart();
        Log.i(TAG,"重启");
    }
    @Override
    protected void onDestroy() {
        super.onDestroy();
        Log.i(TAG, "销毁");
    }

}
